package cn.kgc.kgcuserconsumer.controller;

import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import pojo.User;
import service.UserService;

/**
 * @author geQiang
 * @version 1.0
 * @date 2019/4/12
 * @description cn.kgc.kgcuserconsumer.controller
 */
@RestController
public class UserController {
    @Reference
    private UserService userService;

    @RequestMapping("/login")
    public User longin(
            @RequestParam(value = "username", defaultValue = "", required = false) String username,
            @RequestParam(value = "password", defaultValue = "", required = false) String password) {
        User user = new User();
        user.setPassword(password);
        user.setUsername(username);
        return userService.longin(user);
    }
}
